
'use strict';

/**
	Part of Zombie Navigator
	Copyright © 2015  Zombie Navigator Developers
	
	@file
	@license AGPL-3.0+
*/


/*
	Zombie script example (= unprivileged)
	Do NOT require () this script from the addon code.
	
	Testing window-based private browsing
*/


const {zombie, console} = require('zombie/zombie');
const {openWindow, openPrivateWindow, closeAll} = require('zombie/webbrowser');
const {run, delay} = require('zombie/async');


run(function* () {
	let w = yield openPrivateWindow('about:');
	
	console.log(w);
	console.log(w.uri);
	console.log('isPrivate:', w.isPrivate);
	
	yield delay(5);
	let w2 = yield openPrivateWindow('about:support');
	
	yield delay(1);
	yield w.close();
	
	yield delay(5);
	console.log('reloading...');
	yield w2.reload();
	console.log('reloaded');
	yield w2.runScript(function (... args) {
		console.log(args);
		console.log('length:', document.documentElement.innerHTML.length);
	}, zombie.applicationName, zombie.applicationVersion);
	console.log('script returned');
	
	let w3 = yield openWindow('data:,non-private');
	yield delay(2);
	yield closeAll();
	console.log('closed');
});


// vim: ts=4 noet ai

